#define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:6031)
#include<iostream>
using namespace std;
void test01()
{
	string s1("hello word");
	string s2("xxxxx");
	s1 += s2;
	cout << s1 << endl;
	s1 += "yyyyy";
	cout << s1 << endl;
	s1 += 'O';
	cout << s1 << endl;
}

void test09()
{
	string s1("hello word");
	string s2("xxxxx");
	s1.append(s2, 2);
	cout << s1 << endl;
}

void test10()
{
	string s1("hello word");
	string s2("xxxxx");
	s1.push_back('p');
	cout << s1 << endl;
}

void test11()
{
	string s1("hello word");
	string s2("XXXPPPYYY");
	//s1.insert(0,s2);
	//s1.insert(0, s2,3,3);
	//s1.insert(0, "ssh");
	//s1.insert(0, "ssh",1);
	//s1.insert(0, 1, 'U');
	//s1.insert(s1.begin(), 1, 'U');
	//s1.insert(s1.begin(), 'U');
	cout << s1 << endl;
}

void test12()
{
	string s1("hello word");
	//s1.erase(0,5);
	//s1.erase(s1.begin());
	s1.erase(s1.begin(),s1.end());
	cout << s1 << endl;
}

void test13()
{
	string s1("hello word");
	//s1.replace(0, 5, "xxx");
	//s1.replace(s1.begin(), s1.end(), "xxxxxxxxxx");
	//s1.replace(0, 5, "ABCD", 0, 2);
	cout << s1 << endl;
}

void test14()
{
	string s1("hello word");
	s1.pop_back();
	cout << s1 << endl;
}

void test15()
{
	string s1("hello word");
	const char* p1 = s1.c_str();
	cout << p1 << endl;
}

void test16()
{
	char buffer[20];
	string str("hello word...");
	size_t length = str.copy(buffer, 6, 6);
	buffer[length] = '\0';
	cout << "buffer contains: " << buffer << '\n';
}

void test17()
{
	string s1("hello word ");
	s1[s1.find(' ', 0)] = 'X';
	cout << s1 << endl;
}

void test18()
{
	string str("Please, replace the vowels in this sentence by asterisks.");
	size_t found = str.find_first_of("abcde");
	while (found != string::npos)
	{
		str[found] = '*';
		found = str.find_first_of("abcde", found + 1);
	}
	cout << str << endl;
}

//void SplitFilename(const string& str)
//{
//	cout << "Splitting: " << str << '\n';
//	size_t found = str.find_last_of("/\\");
//	cout << " path: " << str.substr(0, found) << '\n';
//	cout << " file: " << str.substr(found + 1) << '\n';
//}
//
//int main()
//{
//	string str1("/usr/bin/man");
//	string str2("c:\\windows\\winhelp.exe");
//
//	SplitFilename(str1);
//	SplitFilename(str2);
//
//	return 0;
//}

void test19()
{
	string s1("hello word ");
	string s2("hello");
	int ret = s1.compare(s2);
	cout << ret << endl;
}

void test20()
{
	string firstlevel("com");
	string secondlevel("cplusplus");
	string scheme("http://");
	string hostname;
	string url;

	hostname = "www." + secondlevel + '.' + firstlevel;
	url = scheme + hostname;

	cout << url << '\n';
}

#include<string>
void test21()
{
	string name;

	cout << "Please, enter your full name: ";
	getline(cin, name);
	cout << "Hello, " << name << "!\n";
}

int main()
{
	test21();
	return 0;
}